  var currentDiv = "TBD";
  function getPageSize(){
    var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {	
	  xScroll = document.body.scrollWidth;
	  yScroll = window.innerHeight + window.scrollMaxY;
	} 
	else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
	  xScroll = document.body.scrollWidth;
	  yScroll = document.body.scrollHeight;
	} 
	else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
	  xScroll = document.body.offsetWidth;
	  yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
	  windowWidth = self.innerWidth;
	  windowHeight = self.innerHeight;
	} 
	else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
	  windowWidth = document.documentElement.clientWidth;
	  windowHeight = document.documentElement.clientHeight;
    } 
    else if (document.body) { // other Explorers
	  windowWidth = document.body.clientWidth;
	  windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
	  pageHeight = windowHeight;
	} 
	else { 
	  pageHeight = yScroll;
    }
    // for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
	  pageWidth = windowWidth;
	} 
	else {
	  pageWidth = xScroll;
	}
  arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
  }
  function createOverlay(){
    var overDiv = document.createElement("div");
	overDiv.style.position = "absolute";
	overDiv.style.top = "0px";
	overDiv.style.left = "0px";
	overDiv.style.width = getPageSize()[0] + "px";
	overDiv.style.height = getPageSize()[1] + "px";
	overDiv.style.background = "#000000";
	overDiv.style.opacity = "0.1";
	overDiv.style.filter = "alpha(opacity=10)";
	overDiv.style.display = "none";
	document.getElementsByTagName("body").item(0).appendChild(overDiv);
	overDiv.setAttribute("id", "overlayDiv");	
  }	
  function showOverlay(contentDivID, leftPos, topPos, excludeDropDownsArray) {
	toggleDropdowns(false, excludeDropDownsArray);
    currentDiv = contentDivID;
	document.getElementById("overlayDiv").style.display = "block";		
	document.getElementById(contentDivID).style.zIndex = 10000;
	document.getElementById(contentDivID).style.position = "absolute";
	document.getElementById(contentDivID).style.left = leftPos;
	document.getElementById(contentDivID).style.top = topPos;
	document.getElementById(contentDivID).style.display = "block";
  }
  function hideOverlay() {
	toggleDropdowns(true);
    if(currentDiv) { document.getElementById(currentDiv).style.display = "none"; }
	  document.getElementById("overlayDiv").style.display = "none";
  }
  function getElementPosition(elemID) {
    var offsetTrail = document.getElementById(elemID);
	var offsetLeft = 0;
	var offsetTop = 0;
	while (offsetTrail) {
	  offsetLeft += offsetTrail.offsetLeft;
	  offsetTop += offsetTrail.offsetTop;
	  offsetTrail = offsetTrail.offsetParent;
	}
	if (navigator.userAgent.indexOf("Mac") != -1 && 
	  typeof document.body.leftMargin != "undefined") {
	  offsetLeft += parseInt(document.body.leftMargin);
	  offsetTop += parseInt(document.body.topMargin);
	}
	return {left:offsetLeft, top:offsetTop};
  }
  function prepareOverlay(overlayDivId, fromLeft, fromTop, overlayCallerId, excludeDropDownsArray) {
    document.getElementById(overlayDivId).style.opacity = " 0.99999 ";
    fromLeft = getElementPosition(overlayCallerId).left + fromLeft;
	fromTop  = getElementPosition(overlayCallerId).top + fromTop;
	showOverlay(overlayDivId, fromLeft, fromTop, excludeDropDownsArray);
  }
  function toggleDropdowns(showBoolean, excludeDropDownsArray) {
    for(var i=0; i<document.forms.length; i++) {
	  for(var j=0; j<document.forms[i].elements.length; j++) {
	    if(document.forms[i].elements[j].type.indexOf("select")!=-1) {
            elementFound = false;
	    	if (excludeDropDownsArray) {
		    	for (var k=0; k<excludeDropDownsArray.length; k++) {
		    		if (document.forms[i].elements[j].name == excludeDropDownsArray[k]) {
		    			elementFound = true;
		    			break;
		    		}
		    	}
	    	}
	    	if (elementFound == false) {
	    		document.forms[i].elements[j].style.visibility = (showBoolean==true)?'visible':'hidden';	
	    	}
		}
	  }
	}
  }
